//
//  ReceiveLogicHandle.m
//  NLProjectFrameworkDemo
//
//  Created by iosdeveloper on 2020/4/28.
//  Copyright © 2020 yj_zhang. All rights reserved.
//

#import "ReceiveLogicHandle.h"
#import "MJExtension.h"
#import "ChatHandleCommonLogic.h"

@implementation ReceiveLogicHandle

+(WelcomeJsonData*)buildConnetFromWelcom:(NSDictionary*)dic{
     WelcomeJsonData*welModel=[WelcomeJsonData mj_objectWithKeyValues:dic];
    return welModel;
    
}

+(NSMutableArray*)getWelcomeModelFrom:(NSDictionary*)dic{
    NSMutableArray*tempArr=[NSMutableArray new];//初始化数组
    WelcomeJsonData*welModel=[WelcomeJsonData mj_objectWithKeyValues:dic];
    NSArray*subArr=welModel.payload.welcomes.firstObject;
    NSArray*historyArr=welModel.payload.historyMsg;
//    if (historyArr.count>0) {
//        return tempArr;
//    }else{
        for (int i=0; i<subArr.count; i++) {
            NSDictionary*subDic =subArr[i];
            WelcomeJsonwelcomesArrData*welComeModel=[WelcomeJsonwelcomesArrData mj_objectWithKeyValues:subDic];
            [tempArr addObject:welComeModel];
        }
        return tempArr;
//    }
  
}




+( MantisTextCellData *)combineWelcomJsonModel:(NSData*)data{
    MantisTextCellData *cellData = [MantisTextCellData new];
    cellData.isMyself=NO;//左边显示
    cellData.innerMessage = [[TIMMessage alloc] init];
    TIMCustomElem * custom_elem = [ChatHandleCommonLogic getCustomElemModel:data];
    [cellData.innerMessage addElem:custom_elem];
    return cellData;
}



@end
